var F_Basic_Entrance = {
    _init: function (a) {
        if (B_Login._checkUpdate(), M_HeadFoot._headShow(4), "demo" != M_Init._controller && B_User._isDemoUser())B_Login._openLogin("background"); else {
            switch (M_Init._clean(), M_Init._controller) {
                case"demo":
                    $("#gameDropChoose").show(), B_Pop._init("close"), M_Init._api.playerCluster = "demoPlayerCluster", M_Init._api.playerTag = "demoPlayerTag", M_Init._api.clusterType = "demoClusterType", M_Init._api.innerSearchMeta = "demoInnerSearchMeta", M_Init._api.playerData = "demoPlayerData", M_Init._api.innerSearchCsv = "demoInnerSearchCsv", M_Init._api.searchExcel = "demoSearchExcel";
                    break;
                default:
                    M_Init._api.playerCluster = "playerCluster", M_Init._api.playerTag = "playerTag", M_Init._api.clusterType = "clusterType", M_Init._api.innerSearchMeta = "innerSearchMeta", M_Init._api.playerData = "playerData", M_Init._api.searchExcel = "searchExcel"
            }
            $("#headerTop").html("");
            var e = "";
            if (a) {
                if (a = a.split("-"), 3 == a.length) {
                    e = a[0], M_Init._searchKeyword = a[1], M_Init._dataCache.columnType = a[1], M_Init._dataCache.userType = a[2];
                    for (var t = F_Basic_Info._configClassify, _ = 0; _ < t.length; _++)if (t[_].id == M_Init._dataCache.userType) {
                        M_Init._dataCache.userTypeName = t[_].name;
                        break
                    }
                }
                1 == a.length && (M_Init._gameIdRight = a[0])
            }
            M_Common._getOrderGame("basic", e, "8-3")
        }
    }
}, F_Basic_Info = {
    _cache: {},
    _htmlInit: function (a) {
        var e = "";
        switch (a) {
            case"detail":
                e += '<div class="blockpart  col-lg-12 col-md-12 col-sm-12 col-xs-12 ">', e += '<h3 id="bs_detail_tag_title">' + M_Init._dataCache.columnType + "类型" + M_Init._dataCache.userTypeName + "特征描述</h3>", e += '<div class="boxshadow player-multi-tags"></div>', e += "</div>", e += '<div class="blockpart  tg-table-layout col-lg-12 col-md-12 col-sm-12 col-xs-12"><h3 id="bs_column_name">' + M_Init._searchKeyword + "类型" + M_Init._dataCache.userTypeName + " ID 列表</h3>", e += '<div class="boxshadow tg-table-content">', e += '<div class="tg-top-word-tab" id="bs_content_tag"></div>', e += '<div class="tg-table-wrap tg-table-no-padding" id="bs_content_list"><div class="table-out-wrap no-margin-top">', e += '<table class="tg-table table table-bordered"><thead class="boxshadow"></thead><tbody></tbody></table>', e += '</div><ul class="tg-page-list" id="lt_forum_page"></ul></div>', e += "</div></div>";
                break;
            default:
                e += '<div class="blockpart  col-lg-12 col-md-12 col-sm-12 col-xs-12 ">', e += "<h3>玩家特征描述</h3>", e += '<div class="boxshadow player-multi-tags"></div>', e += "</div>", e += '<div class="row all-player-tags col-lg-12 col-md-12 col-sm-12 col-xs-12 "><h3 id="bs_column_name"></h3><div id="bs_radar_list"></div></div>'
        }
        $("#ct_main_area").html(e)
    },
    _htmlColumnName: function (a) {
        var e = "";
        switch (a) {
            case"detail":
                e = M_Init._searchKeyword + "类型-" + M_Init._dataCache.userTypeName + " ID 列表", $("#bs_detail_tag_title").html(M_Init._searchKeyword + "类型-" + M_Init._dataCache.userTypeName + "特征描述"), $("#bs_notice_name").html(M_Init._searchKeyword + "类型-" + M_Init._dataCache.userTypeName);
                break;
            default:
                for (var t = F_Basic_Info._configClassify, _ = 0; _ < t.length; _++)if (M_Init._gameIdRight == t[_].id) {
                    e = t[_].name, M_Init._dataCache.userTypeName = t[_].name;
                    break
                }
                e += "群体构成"
        }
        $("#bs_column_name").html(e)
    },
    _configClassify: [{id: "active", name: "活跃玩家"}, {id: "paid", name: "付费玩家"}, {id: "lost", name: "流失玩家"}],
    _getInfo: function () {
        console.log("basic.js _getInfo");

        if (M_Init._searchKeyword) {
            var a = $("#ct_main_area");
            F_Basic_Info._htmlInit("detail");
            var e = {};
            e.game_id = M_Init._gameId, e = B_Common._postData(e), B_Port._ajax(M_Init._api.clusterType, "get", !0, e, function () {
                B_Pop._init("load", {type: 1, time: 60, shade: [.6, "#000000"]})
            }, function () {
                B_Pop._init("close")
            }, function (e, t) {
                if (e && e.length > 0) {
                    for (var _ = [], i = !1, n = {}, s = 0; s < e.length; s++)_.push({
                        id: e[s],
                        name: e[s] + "类型-" + M_Init._dataCache.userTypeName
                    }), e[s] + "" == M_Init._searchKeyword && (i = !0, n = {
                        id: e[s],
                        name: e[s] + "类型-" + M_Init._dataCache.userTypeName
                    });
                    i || (n = {
                        id: e[0],
                        name: e[0]
                    }, M_Init._searchKeyword = e[0], F_Basic_Info._htmlColumnName("detail"));
                    var l = '<a class="tg-assist-btn" id="bs_btn_back">返回上一级</a><div class="fr analysis-data-des">                                        <span>本次共分析:<b id="bs_number"></b>位<b id="bs_notice_name"> ' + M_Init._searchKeyword + "类型-" + M_Init._dataCache.userTypeName + '</b></span>                                        <a class="tg-main-btn" id="bs_btn_down">ID导出</a>                                     </div>';
                    $("#headerTop").html(M_Inside._dropHtml("bs_type", "选择分析对象:", n, _) + l), $("#bs_btn_back").click(function () {
                        var a = B_Jump._getUrl("operateBasic", {type: M_Init._dataCache.userType});
                        B_Jump._go("base", a)
                    }), M_Inside._dropShow("tg-selected-drop"),
                        M_Inside._dropSelected(function (a, e) {
                        M_Init._searchKeyword = a, M_Init._dataCache.columnType = a, F_Basic_Info._htmlColumnName("detail"), F_Basic_Info._getBase(), M_Operate._getDetail(1)
                    }, "tg-selected-drop"), M_Inside._dropLeave("tg-selected-drop"), F_Basic_Info._getBase(), M_Operate._getTag(), M_Operate._download()
                } else a.html(B_Pre._empty("暂无数据"))
            }, function (e, t, _) {
                a.html(B_Pre._empty(t))
            })
        } else {
            var t = F_Basic_Info._configClassify;
            M_Init._gameIdRight || (M_Init._gameIdRight = "active");
            var _ = {};
            M_Init._dataCache.selectedName = "";
            for (var i = 0; i < t.length; i++)if (t[i].id == M_Init._gameIdRight) {
                _ = t[i], M_Init._dataCache.userTypeName = t[i].name;
                break
            }
            F_Basic_Info._htmlInit(), F_Basic_Info._htmlColumnName(),
                $("#headerTop").html(M_Inside._dropHtml("bs_classify", "选择分析对象:", _, t)), F_Basic_Info._getBase(), F_Basic_Info._getRadar(), M_Inside._dropShow("tg-selected-drop"), M_Inside._dropSelected(function (a, e) {
                M_Init._gameIdRight = a, F_Basic_Info._htmlColumnName(), F_Basic_Info._getBase(), F_Basic_Info._getRadar()
            }, "tg-selected-drop"), M_Inside._dropLeave("tg-selected-drop")
        }
    },
    _htmlBaseItem: function (a, e) {
        var t = "";
        t += '<div class="tg-list">', t += "<h4>" + e.name + "</h4>", t += '<img src="elements2.0/img/tag/' + a.img + '" alt="">', t += '<ul class="column-list">';
        for (var _ = e.data, i = 0; i < _.length; i++)t += F_Basic_Info._htmlBaseItemList(a.class + (i + 1), _[i]);
        return t += "</ul>", t += '<div class="line ' + a.class + '1"></div>', t += "</div>"
    },
    _htmlBaseItemList: function (a, e) {
        e.value = (100 * e.value).toFixed(0);
        var t = "";
        return t += "<li>", t += '<div class="rate-wrap">', t += '<div class="percent-part ' + a + '" style="height: ' + e.value + '%"></div>', t += "</div>", e.desc && (t += '<div class="tip-box-show"> <i class="triangle-up"></i>', t += '<div class="tip-box-content">' + e.desc + "</div>", t += "</div>"), t += '<div class="des">', t += "<p>" + e.name + "</p>", t += '<b class="' + a + '-text">' + e.value + "</b>", t += "</div>", t += "</li>"
    },
    _htmlBase: function (a) {
        for (var e = ["blue", "green", "purple", "yellow", "red"], t = "", _ = 0, i = {
            class: "",
            img: ""
        }, n = 0; n < a.length; n++)i.class = e.length - 1 >= _ ? e[_] : e[_.length - 1], _++, 2 == a[n].data.length ? i.img = "small.jpg" : i.img = "big.jpg", t += F_Basic_Info._htmlBaseItem(i, a[n]);
        return t
    },
    _getBase: function () {
        var a = $(".player-multi-tags"), e = {};
        M_Init._searchKeyword ? (e.user_type = M_Init._dataCache.userType, e.cluster_type = M_Init._searchKeyword) : e.user_type = M_Init._gameIdRight, e.game_id = M_Init._gameId, e = B_Common._postData(e), B_Port._ajax(M_Init._api.playerCluster, "post", !0, e, function () {
            a.html(B_Pre._loading())
        }, function () {
            a.html("")
        }, function (e, t) {
            e && e.length > 0 ? a.html(F_Basic_Info._htmlBase(e)) : a.html(B_Pre._empty("暂无数据"))
        }, function (e, t, _) {
            a.html(B_Pre._empty(t))
        })
    },
    _getRadar: function () {
        var a = $("#bs_radar_list"), e = {};
        e.user_type = M_Init._gameIdRight, e.game_id = M_Init._gameId, e = B_Common._postData(e), B_Port._ajax(M_Init._api.playerTag, "post", !0, e, function () {
            a.html(B_Pre._loading())
        }, function () {
            a.html("")
        }, function (e, t) {
            if (e) {
                var _ = [{name: "blue", value: "#3399dc"}, {name: "green", value: "#2dcd70"}, {
                    name: "purple",
                    value: "#774689"
                }, {name: "yellow", value: "#f3d049"}, {name: "blue1", value: "#2d55ce"}, {
                    name: "red",
                    value: "#e44d3c"
                }, {name: "green1", value: "#0f735e"}, {name: "purple1", value: "#431f5e"}];
                a.html(F_Basic_Info._htmlRadar(e, _)), F_Basic_Info._chartRadar(_), a.find("a").each(function () {
                    $(this).click(function () {
                        var a = $(this).attr("data-i"), e = B_Jump._getUrl("operateBasic", {type: M_Init._gameId + "-" + a + "-" + M_Init._gameIdRight});
                        B_Jump._go("base", e)
                    })
                })
            } else a.html(B_Pre._empty("暂无数据"))
        }, function (e, t, _) {
            a.html(B_Pre._empty(t))
        })
    },
    _htmlRadar: function (a, e) {
        for (var t = "", _ = {}, i = "", n = 0; n < a.length; n++)_[n] = a[n], i = e[n] ? e[n].name : e[0].name, t += '<div class="blockpart no-title  col-lg-3 col-md-6 col-sm-6 col-xs-6">                        <div class="boxshadow border-' + i + '">                            <div class="top-des">                                <p>' + a[n].name + "类型-" + M_Init._dataCache.userTypeName + "</p>                                <b>" + a[n].data.user_num + '人</b>                            </div>                            <div class="graph-part" id="bs_radar_' + n + '" style="width: 100%;height: 270px"></div>                            <a data-i="' + a[n].name + '" class="tg-assist-btn">查看详情</a>                        </div>                    </div>';
        return F_Basic_Info._cache.radar = _, t
    },
    _chartRadar: function (a) {
        var e = {
            "活跃度": "activity",
            "能力评估": "capability_eva",
            "社交": "social",
            "玩法参与": "gameplay",
            "消费": "consume"
        }, t = {}, _ = "", i = "";
        F_Basic_Info._cache.radar && $.each(F_Basic_Info._cache.radar, function (n, s) {
            n = parseInt(n), _ = a[n] ? a[n].value : a[0].value, i = s.name + "类型玩家", t = {
                indicator: [],
                data: {},
                legendSelectMode: !0,
                color: [_, _]
            }, t.data[i] = [], $.each(e, function (a, e) {
                t.indicator.push({text: a, max: 100}), t.data[i].push(s.data[e] ? (100 * s.data[e]).toFixed(0) : 0)
            }), M_Inside_Chart._chartData("60", "bs_radar_" + n, t)
        })
    }
};